package model.semantics;

import java.util.List;

import model.State;
import model.TurtleState;

/**
 * Represents a generic unary operation.
 * 
 * @author Sterling Dorminey
 */
public class UnaryOperation extends Operation<Integer> {

    public UnaryOperation(String label) {
        super(1, label);
    }

    @Override
    protected Integer evaluateSafely(State<Integer> state, List<Integer> values) {
        return evaluateValue((TurtleState) state, values.get(0));
    }

    /**
     * Given a value, transform it into a new value.
     * 
     */
    protected Integer evaluateValue(TurtleState state, Integer value) {
        return state.runCommand(myLabel.trim(), value);
    }
}
